
#ifndef	__FECAB_CLIENT_HPP_2010__
#define	__FECAB_CLIENT_HPP_2010__

#include <string>
#include <utility>
#include <vector>

#include <boost/thread/mutex.hpp>


namespace	confab	{
namespace	client	{

class	Broker;

class	Client
{

public	:
	Client( const char* app_config );
	Client( const char* host, int port );

	~Client();

public	:
    
	int   put( const std::string& key,  
			   const std::string& data );

	int   get( const std::string& key,  
			         std::string& data );

	int   erase( 
			   const std::string& key );

private	:
	int		parseAppConfig( const char* filename );
	int		parseLogConfig( const char* filename );

	int		initialize();
	int		finalize();

	int		getSid();

private	:
	Broker*	getBroker( void );

	int		callBroker( Broker* broker_p, const std::string& request, std::string& response );

private	:
	typedef	std::string	host_type;
	typedef	std::string	port_type;
	typedef	std::pair< host_type, port_type >	server_address_type;
	typedef	std::vector< server_address_type >	server_address_list_type;
	server_address_list_type	server_address_list;
	
	typedef	std::vector< Broker* >	server_list_type;
	server_list_type	server_list;

	int		_current_sid;
	boost::mutex	_current_sid_mutex;

};	// class Client


}	// namespace client
}	// namespace confab

#endif	// __FECAB_CLIENT_HPP_2010__

